-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split performStream into functions handling stream of futures #68
Conversation
e9cc723
to
553aefd
Compare
This comment has been minimized.
This comment has been minimized.
Codecov Report
@@ Coverage Diff @@
## master #68 +/- ##
==========================================
+ Coverage 95.79% 96.25% +0.45%
==========================================
Files 13 13
Lines 1476 1494 +18
Branches 130 135 +5
==========================================
+ Hits 1414 1438 +24
+ Misses 62 56 -6
Continue to review full report at Codecov.
|
Here's a diagram, inspired by the one @stevekrouse did in #57 that tries to show the difference between the |
@@ -1,7 +1,6 @@ | |||
language: node_js | |||
node_js: | |||
- "node" | |||
- "8" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of the test implementations use Array#flatMap
which this old NodeJS version does not support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing jumps in my eye. LGTM
Really nice work 😄 My only comment is that I don't find the name Future<Future<A>> -> Future<A> where the actual type is: Stream<Future<A>> -> Now<Stream<A>> the only difference in the naming is the addition of
It is nice grouping functions which are sharing properties together, but I find it more important to use a name, which describes the behavior of a function rather then the properties of a function and I also believe it to be easier to remember. Instead I suggest something like |
I think Not only are the types similar. The behavior is also very similar. On top of the useful analogy with On the other hand I don't think |
553aefd
to
ba08ae5
Compare
I've renamed |
This PR changes
into
In other words, there is now a single function for running a stream and it results in a stream of futures. To flatten/unnest this stream of futures one then has to use one of the three new functions for doing so. But, these new functions can be used in any circumstance where one has a stream of futures.
We can discuss the names of the last three function. The logic behind the current names is that
flat
is a function that turnsM<M<A>>
intoM<A>
while satisfying things likeflat(map(v => M.of(v)) === v
and the new functions are similar in thatflatFuture
turns aStream<Future<A>>
into aStream<A>
while satisfying things likeflatFuture(map(v => Future.of(v), stream)) === stream
. Hence the idea is that highlighting the similarity by using a familiar word "flat" will make it easier to understand and remember what this new function does.Related to: funkia/purescript-hareactive#3